Ubuntu 16.04
Sponsored Link

OpenStack Pike : How to use Manila#2
2017/09/18
 
This is How to use OpenStack Shared File System (Manila).
This example is based on the emvironment like follows.
For example, Configure Manila share to use a designed instance.
It needs to use Cinder storage for backends, so Configure Cinder service first.
On this example, create and use a Cinder storage [disk01] with 10G by LVM backend like here.
------------+---------------------------+---------------------------+------------
            |                           |                           |
        eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+
|    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |
|                       |   |                       |   |                       |
|  MariaDB    RabbitMQ  |   |     Cinder-Volume     |   |        Libvirt        |
|  Memcached  httpd     |   |        L2 Agent       |   |     Nova Compute      |
|  Keystone   Glance    |   |        L3 Agent       |   |        L2 Agent       |
|  Nova API  Cinder API |   |     Metadata Agent    |   |                       |
|  Neutron Server       |   |      Manila Share     |   |                       |
|  Metadata Agent       |   |                       |   |                       |
|  Manila API           |   |                       |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

[1] Configure Storage Node.
root@storage:~#
vi /etc/manila/manila.conf
# add follows into [DEFAULT] section

enabled_share_backends = generic

# add follows to the end
[neutron]
url = http://10.0.0.30:9696
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = servicepassword

[nova]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = servicepassword

[cinder]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = cinder
password = servicepassword

[generic]
share_backend_name = backend01
share_driver = manila.share.drivers.generic.GenericShareDriver
driver_handles_share_servers = True
service_instance_flavor_id = 1
service_instance_security_group = manila-service
service_image_name = manila-service-image
service_instance_user = manila
service_instance_password = manila
interface_driver = manila.network.linux.interface.BridgeInterfaceDriver

root@storage:~#
systemctl restart manila-share

[2] Download official Manila designed image and add it to Glance. And more, create a security group for Manila Service.
root@dlp ~(keystone)#
wget http://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2

root@dlp ~(keystone)#
openstack image create "manila-service-image" --file manila-service-image-master.qcow2 --disk-format qcow2 --container-format bare --public

+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | 2bf61c8f8fc4f0305a01efcf28a28151                     |
| container_format | bare                                                 |
| created_at       | 2017-09-20T08:00:29Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/2c6ac332-310e-4fff-bcc2-2ff2e15b2257/file |
| id               | 2c6ac332-310e-4fff-bcc2-2ff2e15b2257                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | manila-service-image                                 |
| owner            | 1ca37b956ae4451892dfcc47f5f98913                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 337947136                                            |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2017-09-20T08:00:32Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+

root@dlp ~(keystone)#
openstack security group create manila-service

+-----------------+------------------------------------------------------------+
| Field           | Value                                                      |
+-----------------+------------------------------------------------------------+
| created_at      | 2017-09-20T08:21:49Z                                       |
| description     | manila-service                                             |
| id              | 88f34ad9-5dc3-4017-a730-64c53a54ca09                       |
| name            | manila-service                                             |
| project_id      | 1ca37b956ae4451892dfcc47f5f98913                           |
| revision_number | 2                                                          |
| rules           | created_at='2017-09-20T08:21:49Z', direction='egress', ... |
|                 | created_at='2017-09-20T08:21:49Z', direction='egress', ... |
| updated_at      | 2017-09-20T08:21:49Z                                       |
+-----------------+------------------------------------------------------------+
[3] Create default share type.
root@dlp ~(keystone)#
manila type-create default_share_type True

+----------------------+--------------------------------------+
| Property             | Value                                |
+----------------------+--------------------------------------+
| required_extra_specs | driver_handles_share_servers : True  |
| Name                 | default_share_type                   |
| Visibility           | public                               |
| is_default           | -                                    |
| ID                   | 8088b129-c322-4b6c-a5d2-8ca994f9df39 |
| optional_extra_specs |                                      |
+----------------------+--------------------------------------+

root@dlp ~(keystone)#
manila type-list

+-----------+--------------------+------------+------------+-------------------------------------+--------+
| ID        | Name               | visibility | is_default | required_extra_specs                | opt... |
+-----------+--------------------+------------+------------+-------------------------------------+--------+
| 8088b129- | default_share_type | public     | YES        | driver_handles_share_servers : True |        |
+-----------+--------------------+------------+------------+-------------------------------------+--------+
[4] Create shared network.
root@dlp ~(keystone)#
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| 5adc2598-4ebe-4110-b6bf-47d9e2b5c48e | ext_net | 6572863d-f10a-456e-932c-2581d39a3349 |
| fcfcf86c-40a6-4c79-9431-feb74dc5a6bc | int_net | 65e69dd1-0b8c-43d7-9c44-b8099a2e0f82 |
+--------------------------------------+---------+--------------------------------------+

root@dlp ~(keystone)#
openstack subnet list

+--------------------------------------+---------+--------------------------------------+------------------+
| ID                                   | Name    | Network                              | Subnet           |
+--------------------------------------+---------+--------------------------------------+------------------+
| 6572863d-f10a-456e-932c-2581d39a3349 | subnet2 | 5adc2598-4ebe-4110-b6bf-47d9e2b5c48e | 10.0.0.0/24      |
| 65e69dd1-0b8c-43d7-9c44-b8099a2e0f82 | subnet1 | fcfcf86c-40a6-4c79-9431-feb74dc5a6bc | 192.168.100.0/24 |
+--------------------------------------+---------+--------------------------------------+------------------+

root@dlp ~(keystone)#
INT_NET=$(openstack network list | grep 'int_net' | awk '{print $2}')

root@dlp ~(keystone)#
INT_SUBNET=$(openstack subnet list | grep 'subnet1' | awk '{print $2}')
root@dlp ~(keystone)#
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share

+-------------------+--------------------------------------+
| Property          | Value                                |
+-------------------+--------------------------------------+
| network_type      | None                                 |
| name              | manila_share                         |
| segmentation_id   | None                                 |
| created_at        | 2017-09-20T08:02:35.918142           |
| neutron_subnet_id | 65e69dd1-0b8c-43d7-9c44-b8099a2e0f82 |
| updated_at        | None                                 |
| mtu               | None                                 |
| gateway           | None                                 |
| neutron_net_id    | fcfcf86c-40a6-4c79-9431-feb74dc5a6bc |
| ip_version        | None                                 |
| cidr              | None                                 |
| project_id        | 1ca37b956ae4451892dfcc47f5f98913     |
| id                | f64c94cd-0d1e-48aa-9232-abf4cc40047c |
| description       | None                                 |
+-------------------+--------------------------------------+

root@dlp ~(keystone)#
manila share-network-list

+--------------------------------------+--------------+
| id                                   | name         |
+--------------------------------------+--------------+
| f64c94cd-0d1e-48aa-9232-abf4cc40047c | manila_share |
+--------------------------------------+--------------+
[5] Create NFS share.
# create a flavor id 1

root@dlp ~(keystone)#
openstack flavor create --id 1 --vcpus 1 --ram 2048 --disk 10 m1.tiny

+----------------------------+---------+
| Field                      | Value   |
+----------------------------+---------+
| OS-FLV-DISABLED:disabled   | False   |
| OS-FLV-EXT-DATA:ephemeral  | 0       |
| access_project_ids         | None    |
| disk                       | 10      |
| id                         | 1       |
| name                       | m1.tiny |
| os-flavor-access:is_public | True    |
| properties                 |         |
| ram                        | 2048    |
| rxtx_factor                | 1.0     |
| swap                       |         |
| vcpus                      | 1       |
+----------------------------+---------+

root@dlp ~(keystone)#
manila create NFS 5 --name share01 --share-network manila_share

+---------------------------------------+--------------------------------------+
| Property                              | Value                                |
+---------------------------------------+--------------------------------------+
| status                                | creating                             |
| share_type_name                       | default_share_type                   |
| description                           | None                                 |
| availability_zone                     | None                                 |
| share_network_id                      | 5375898b-efb3-46da-9cc0-a03b57c4bb1d |
| share_server_id                       | None                                 |
| share_group_id                        | None                                 |
| host                                  |                                      |
| revert_to_snapshot_support            | False                                |
| access_rules_status                   | active                               |
| snapshot_id                           | None                                 |
| create_share_from_snapshot_support    | False                                |
| is_public                             | False                                |
| task_state                            | None                                 |
| snapshot_support                      | False                                |
| id                                    | b5c936cf-0fed-450f-a17b-4a7e2a56cd74 |
| size                                  | 5                                    |
| source_share_group_snapshot_member_id | None                                 |
| user_id                               | 71b407652ab4433a801915ab21018ffd     |
| name                                  | share01                              |
| share_type                            | 7be400a9-3490-4a82-ac6c-e283596a79e0 |
| has_replicas                          | False                                |
| replication_type                      | None                                 |
| created_at                            | 2017-09-20T08:28:53.000000           |
| share_proto                           | NFS                                  |
| mount_snapshot_support                | False                                |
| project_id                            | 1ca37b956ae4451892dfcc47f5f98913     |
| metadata                              | {}                                   |
+---------------------------------------+--------------------------------------+

# few minutes later, the Status turns to available

root@dlp ~(keystone)#
manila list

+-----------+---------+------+-------------+-----------+-----------+--------------------+---------+--------+
| ID        | Name    | Size | Share Proto | Status    | Is Public | Share Type Name    | Host    | Avai.. |
+-----------+---------+------+-------------+-----------+-----------+--------------------+---------+--------+
| b5c936cf- | share01 | 5    | NFS         | available | False     | default_share_type | netwo.. | nova   |
+-----------+---------+------+-------------+-----------+-----------+--------------------+---------+--------+
[6] At this point, 10.254.0.8/28 network has been created on Storage Node.
root@storage:~#
ip addr

.....
.....
18: ns-0963d2bb-78@tap0963d2bb-78: <BROADCAST,MULTICAST,UP,LOWER_UP> 
       mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether fa:16:3e:3d:a1:3b brd ff:ff:ff:ff:ff:ff
    inet 10.254.0.8/28 brd 10.254.0.15 scope global ns-0963d2bb-78
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:fe3d:a13b/64 scope link
       valid_lft forever preferred_lft forever
.....
.....
[7] It's OK all, you can use Manila Shared filesystem from Instances like follows.
root@dlp ~(keystone)#
openstack server list

+-----------+-------------+---------+------------------------------------+------------+----------+
| ID        | Name        | Status  | Networks                           | Image      | Flavor   |
+-----------+-------------+---------+------------------------------------+------------+----------+
| f5ae3046- | Ubuntu_1604 | SHUTOFF | int_net=192.168.100.10, 10.0.0.210 | Ubuntu1604 | m1.small |
+-----------+-------------+---------+------------------------------------+------------+----------+

# allow access rights first

root@dlp ~(keystone)#
manila access-allow share01 ip 10.0.0.0/24 --access-level rw

+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| access_key   | None                                 |
| share_id     | b5c936cf-0fed-450f-a17b-4a7e2a56cd74 |
| created_at   | 2017-09-20T08:32:14.000000           |
| updated_at   | None                                 |
| access_type  | ip                                   |
| access_to    | 10.0.0.0/24                          |
| access_level | rw                                   |
| state        | queued_to_apply                      |
| id           | d9f2e371-1ed5-4186-a0cb-ddd3bab4cbe5 |
+--------------+--------------------------------------+

# it's no ploblem if State turns to active

root@dlp ~(keystone)#
manila access-list share01

+-----------+-------------+-------------+--------------+--------+------------+--------------+------------+
| id        | access_type | access_to   | access_level | state  | access_key | created_at   | updated_at |
+-----------+-------------+-------------+--------------+--------+------------+--------------+------------+
| d9f2e371- | ip          | 10.0.0.0/24 | rw           | active | None       | 2017-09-2... | None       |
+-----------+-------------+-------------+--------------+--------+------------+--------------+------------+

root@dlp ~(keystone)#
openstack server start Ubuntu_1604

# confirm access Path

root@dlp ~(keystone)#
manila show share01 | grep path | cut -d'|' -f3

path = 10.254.0.4:/shares/share-1219c504-da42-4bbc-a450-cc922955bbc7
root@dlp ~(keystone)#
ssh ubuntu@10.0.0.210

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-93-generic x86_64)
# mount Manila shared storage

ubuntu@ubuntu-1604:~$
sudo mount -t nfs 10.254.0.4:/shares/share-1219c504-da42-4bbc-a450-cc922955bbc7 /mnt

ubuntu@ubuntu-1604:~$
df -hT

Filesystem                              Type      Size  Used Avail Use% Mounted on
/dev/mapper/cl-root                     xfs       8.0G 1015M  7.0G  13% /
devtmpfs                                devtmpfs  990M     0  990M   0% /dev
tmpfs                                   tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                                   tmpfs    1001M  8.3M  993M   1% /run
tmpfs                                   tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1                               xfs      1014M  121M  894M  12% /boot
tmpfs                                   tmpfs     201M     0  201M   0% /run/user/0
10.254.0.4:/shares/share-1219c504-da... nfs4      976M  1.3M  908M   1% /mnt
 
Tweet